package com.probiz.estore.imports.handler.catalog.productCategory;

import org.apache.log4j.Logger;

import com.probiz.estore.catalog.service.ProductCategoryManager;
import com.probiz.estore.common.model.catalog.ProductCategory;
import com.probiz.estore.imports.handler.PersistenceHandler;
import com.probiz.estore.imports.model.ImportModel;

public class ProductCategoryPersistenceHandlerImpl implements PersistenceHandler{
	private Logger logger=Logger.getLogger(ProductCategoryPersistenceHandlerImpl.class);
	private ProductCategoryManager	productCategoryManager	= null;
	public void setProductCategoryManager(ProductCategoryManager productCategoryManager) {
		this.productCategoryManager = productCategoryManager;
	}
	public void saveOrUpdate(ImportModel importModel) {
		ProductCategory category=(ProductCategory)importModel.getTarget();
		if(category.getCategoryId() != null){
			category.setCreateBy(importModel.getAppUserId());
		}
		category.setUpdateBy(importModel.getAppUserId());
		productCategoryManager.saveFullyForImport(category);
		importModel.setResult(ImportModel.RESULT_SUCCESS);
	}

	public void validate(ImportModel importModel) {
		
	}
	
	

}
